package com.tianji.learning.controller;


import com.tianji.api.client.learning.LearningClient;
import com.tianji.api.dto.leanring.LearningLessonDTO;
import com.tianji.api.dto.leanring.LearningRecordFormDTO;
import com.tianji.learning.service.ILearningLessonService;
import com.tianji.learning.service.ILearningRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 学习记录表 前端控制器
 * </p>
 *
 * @author huanghui
 * @since 2023-07-21
 */
@RestController
@RequestMapping("/learning-records")
@RequiredArgsConstructor
@Api(tags = "学习记录相关接口")
public class LearningRecordController {



    private final ILearningRecordService recordService;

    /** @author ZXX-挚爱
    * @Description 查看指定课程的相关记录
    * @Dete 22:11 2023/7/22
    * @Param [courseId]
    * @return com.tianji.api.dto.leanring.LearningLessonDTO
    **/

    @ApiOperation("查看指定课程的相关记录")
    @GetMapping("/course/{courseId}")
    public LearningLessonDTO queryLearningRecordByCourse(
            @ApiParam(value = "课程Id",example = "2")
            @PathVariable("courseId") Long courseId){

        return recordService.queryLearningRecordByCourse(courseId);
    }
    @ApiOperation("提交学习记录接口")
    @PostMapping
    public void addLearningRecord(@RequestBody LearningRecordFormDTO formDTO){
        recordService.addLearningRecord(formDTO);
    }

}
